// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.Inference;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.Json.GoogleVertexAIServiceSettingsConverter))]
public sealed partial class GoogleVertexAIServiceSettings
{
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public GoogleVertexAIServiceSettings(string serviceAccountJson)
	{
		ServiceAccountJson = serviceAccountJson;
	}
#if NET7_0_OR_GREATER
	public GoogleVertexAIServiceSettings()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	[System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")]
	public GoogleVertexAIServiceSettings()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the number of dimensions the resulting output embeddings should have.
	/// By default, the model's standard output dimension is used.
	/// Refer to the Google documentation for more information.
	/// </para>
	/// </summary>
	public int? Dimensions { get; set; }

	/// <summary>
	/// <para>
	/// The name of the location to use for the inference task for the Google Vertex AI inference task.
	/// For Google Vertex AI, when <c>provider</c> is omitted or <c>google</c> <c>location</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>location</c> is ignored.
	/// Refer to the Google documentation for the list of supported locations.
	/// </para>
	/// </summary>
	public string? Location { get; set; }

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// For Google Vertex AI <c>model_id</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>model_id</c> will be used for some providers that require it, otherwise - ignored.
	/// Refer to the Google documentation for the list of supported models for Google Vertex AI.
	/// </para>
	/// </summary>
	public string? ModelId { get; set; }

	/// <summary>
	/// <para>
	/// The name of the project to use for the Google Vertex AI inference task.
	/// For Google Vertex AI <c>project_id</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>project_id</c> is ignored.
	/// </para>
	/// </summary>
	public string? ProjectId { get; set; }

	/// <summary>
	/// <para>
	/// The name of the Google Model Garden Provider for <c>completion</c> and <c>chat_completion</c> tasks.
	/// In order for a Google Model Garden endpoint to be used <c>provider</c> must be defined and be other than <c>google</c>.
	/// Modes:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// Google Model Garden (third-party models): set <c>provider</c> to a supported non-<c>google</c> value and provide <c>url</c> and/or <c>streaming_url</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// Google Vertex AI: omit <c>provider</c> or set it to <c>google</c>. In this mode, do not set <c>url</c> or <c>streaming_url</c> and Elastic will construct the endpoint url from <c>location</c>, <c>model_id</c>, and <c>project_id</c> parameters.
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleModelGardenProvider? Provider { get; set; }

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.
	/// By default, the <c>googlevertexai</c> service sets the number of requests allowed per minute to 30.000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; }

	/// <summary>
	/// <para>
	/// A valid service account in JSON format for the Google Vertex AI API.
	/// </para>
	/// </summary>
	public
#if NET7_0_OR_GREATER
	required
#endif
	string ServiceAccountJson { get; set; }

	/// <summary>
	/// <para>
	/// The URL for streaming <c>completion</c> and <c>chat_completion</c> requests to a Google Model Garden provider endpoint.
	/// If both <c>streaming_url</c> and <c>url</c> are provided, each is used for its respective mode.
	/// If <c>url</c> is not provided, <c>streaming_url</c> is also used for non-streaming <c>completion</c> requests.
	/// If <c>provider</c> is not provided or set to <c>google</c> (Google Vertex AI), do not set <c>streaming_url</c> (or <c>url</c>).
	/// At least one of <c>streaming_url</c> or <c>url</c> must be provided for Google Model Garden endpoint usage.
	/// Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face).
	/// Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’s <c>Sample request</c> page. The request examples also illustrate the proper formatting for the <c>streaming_url</c>.
	/// </para>
	/// </summary>
	public string? StreamingUrl { get; set; }

	/// <summary>
	/// <para>
	/// The URL for non-streaming <c>completion</c> requests to a Google Model Garden provider endpoint.
	/// If both <c>url</c> and <c>streaming_url</c> are provided, each is used for its respective mode.
	/// If <c>streaming_url</c> is not provided, <c>url</c> is also used for streaming <c>completion</c> and <c>chat_completion</c>.
	/// If <c>provider</c> is not provided or set to <c>google</c> (Google Vertex AI), do not set <c>url</c> (or <c>streaming_url</c>).
	/// At least one of <c>url</c> or <c>streaming_url</c> must be provided for Google Model Garden endpoint usage.
	/// Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face).
	/// Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’s <c>Sample request</c> page. The request examples also illustrate the proper formatting for the <c>url</c>.
	/// </para>
	/// </summary>
	public string? Url { get; set; }
}

public readonly partial struct GoogleVertexAiServiceSettingsDescriptor
{
	internal Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public GoogleVertexAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public GoogleVertexAiServiceSettingsDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor descriptor) => descriptor.Instance;

	/// <summary>
	/// <para>
	/// For a <c>text_embedding</c> task, the number of dimensions the resulting output embeddings should have.
	/// By default, the model's standard output dimension is used.
	/// Refer to the Google documentation for more information.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor Dimensions(int? value)
	{
		Instance.Dimensions = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the location to use for the inference task for the Google Vertex AI inference task.
	/// For Google Vertex AI, when <c>provider</c> is omitted or <c>google</c> <c>location</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>location</c> is ignored.
	/// Refer to the Google documentation for the list of supported locations.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor Location(string? value)
	{
		Instance.Location = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// For Google Vertex AI <c>model_id</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>model_id</c> will be used for some providers that require it, otherwise - ignored.
	/// Refer to the Google documentation for the list of supported models for Google Vertex AI.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ModelId(string? value)
	{
		Instance.ModelId = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the project to use for the Google Vertex AI inference task.
	/// For Google Vertex AI <c>project_id</c> is mandatory.
	/// For Google Model Garden's <c>completion</c> and <c>chat_completion</c> tasks, when <c>provider</c> is a supported non-<c>google</c> value - <c>project_id</c> is ignored.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ProjectId(string? value)
	{
		Instance.ProjectId = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the Google Model Garden Provider for <c>completion</c> and <c>chat_completion</c> tasks.
	/// In order for a Google Model Garden endpoint to be used <c>provider</c> must be defined and be other than <c>google</c>.
	/// Modes:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// Google Model Garden (third-party models): set <c>provider</c> to a supported non-<c>google</c> value and provide <c>url</c> and/or <c>streaming_url</c>.
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// Google Vertex AI: omit <c>provider</c> or set it to <c>google</c>. In this mode, do not set <c>url</c> or <c>streaming_url</c> and Elastic will construct the endpoint url from <c>location</c>, <c>model_id</c>, and <c>project_id</c> parameters.
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor Provider(Elastic.Clients.Elasticsearch.Inference.GoogleModelGardenProvider? value)
	{
		Instance.Provider = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.
	/// By default, the <c>googlevertexai</c> service sets the number of requests allowed per minute to 30.000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value)
	{
		Instance.RateLimit = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.
	/// By default, the <c>googlevertexai</c> service sets the number of requests allowed per minute to 30.000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit()
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null);
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from Google Vertex AI.
	/// By default, the <c>googlevertexai</c> service sets the number of requests allowed per minute to 30.000.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor RateLimit(System.Action<Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor>? action)
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action);
		return this;
	}

	/// <summary>
	/// <para>
	/// A valid service account in JSON format for the Google Vertex AI API.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor ServiceAccountJson(string value)
	{
		Instance.ServiceAccountJson = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The URL for streaming <c>completion</c> and <c>chat_completion</c> requests to a Google Model Garden provider endpoint.
	/// If both <c>streaming_url</c> and <c>url</c> are provided, each is used for its respective mode.
	/// If <c>url</c> is not provided, <c>streaming_url</c> is also used for non-streaming <c>completion</c> requests.
	/// If <c>provider</c> is not provided or set to <c>google</c> (Google Vertex AI), do not set <c>streaming_url</c> (or <c>url</c>).
	/// At least one of <c>streaming_url</c> or <c>url</c> must be provided for Google Model Garden endpoint usage.
	/// Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face).
	/// Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’s <c>Sample request</c> page. The request examples also illustrate the proper formatting for the <c>streaming_url</c>.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor StreamingUrl(string? value)
	{
		Instance.StreamingUrl = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The URL for non-streaming <c>completion</c> requests to a Google Model Garden provider endpoint.
	/// If both <c>url</c> and <c>streaming_url</c> are provided, each is used for its respective mode.
	/// If <c>streaming_url</c> is not provided, <c>url</c> is also used for streaming <c>completion</c> and <c>chat_completion</c>.
	/// If <c>provider</c> is not provided or set to <c>google</c> (Google Vertex AI), do not set <c>url</c> (or <c>streaming_url</c>).
	/// At least one of <c>url</c> or <c>streaming_url</c> must be provided for Google Model Garden endpoint usage.
	/// Certain providers require separate URLs for streaming and non-streaming operations (e.g., Anthropic, Mistral, AI21). Others support both operation types through a single URL (e.g., Meta, Hugging Face).
	/// Information on constructing the URL for various providers can be found in the Google Model Garden documentation for the model, or on the endpoint’s <c>Sample request</c> page. The request examples also illustrate the proper formatting for the <c>url</c>.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor Url(string? value)
	{
		Instance.Url = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings Build(System.Action<Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAiServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.GoogleVertexAIServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}